package com.sky.mapper;

import com.sky.dto.ShoppingCartDTO;
import com.sky.entity.ShoppingCart;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

@Mapper
public interface ShoppingCartMapper {

    //  根据用户id、菜品、套餐 id 和口味、获取
    public ShoppingCart getIsYou(ShoppingCart shoppingCart);

    public void add(ShoppingCart shoppingCart);

    //根据 购物车id进行 修改 数量
    public void updateByNumber(ShoppingCart shoppingCart);

    @Select("select * from shopping_cart where user_id=#{userId}")
    public List<ShoppingCart> getByUserId(Long userId);

    //根据 用户id 和 菜品或套餐id 口味 进行删除字段
    public void deleteByDishOrSetmealById(ShoppingCart shoppingCart);

    @Delete("delete from shopping_cart where user_id =#{userId}")
    public void cleanByUserId(Long userId);


}
